package edu.zju.gis.dbfg.server.model;

import edu.zju.gis.dbfg.server.util.ExternalDataUtil;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class MysqlSource extends ExternalDataUtil {
    private String IP;
    private String database;
    private String password;
    private String port;
    private String userName;
    private String dataName;
    private String tableName;

    //添加字段信息
    private String fields;
    private String spatialField;
    //    private String timeFileld;
    private String timeField;

    public MysqlSource(ExternalDataArgs sourceConnect){
        this.setDatabase(sourceConnect.getDatabaseName());
        this.setPassword(sourceConnect.getPassword());
        this.setIP(sourceConnect.getIp());
       String connectionName = "jdbc:mysql://" + sourceConnect.getIp() + ":" + sourceConnect.getPort() + "/" + sourceConnect.getDatabaseName();
        this.setConnectionName(connectionName);
        this.setPort(sourceConnect.getPort());
        this.setUserName(sourceConnect.getUserName());
        this.setDataName(sourceConnect.getDataName());
        this.setTableName(sourceConnect.getTableName());
        this.setFields(sourceConnect.getFields());
        this.setTimeField(sourceConnect.getTimeField());
        this.setSpatialField(sourceConnect.getSpatialField());
    }

    public MysqlSource(){
        this.setDatabase("");
        this.setPassword("");
        this.setIP("");
        this.setConnectionName("");
        this.setPort("");
        this.setUserName("");
        this.setDataName("");
        this.setTableName("");
        this.setFields("");
        this.setTimeField("");
        this.setSpatialField("");
    }
}

